<?php

namespace App\Validate;

use App\Validate\BaseValidate;

class ResourceTotalValidate extends  BaseValidate
{
    //验证规则
    protected $rule = [
        'id' => 'bail|required|integer',
        'img' => 'bail|required',
        'type_id' => 'bail|required|integer',
        'chapter_id' => 'bail|required|integer',
        'title' => 'bail|required',
        'content' => 'bail|required',

        'resource_business_id' => 'bail|required|integer',
        'guid' => 'bail|required|size:32',
        'collect_id' => 'bail|required',
        'guids' => 'bail|required',
        'is_recom' => 'bail|required|integer|in:1,2',

    ];
    //自定义验证信息
    protected $message = [
        'id.required' => 'ID不能为空',
        'id.integer' => 'ID格式不正确',
        'book_id.required' => 'ID不能为空',
        'book_id.integer' => 'ID格式不正确',
        'img.required' => '图片不能为空',
        'type_id.required' => '类型ID不能为空',
        'type_id.integer' => '类型ID格式不正确',
        'chapter_id.required' => '章节ID不能为空',
        'chapter_id.integer' => '章节ID格式不正确',
        'title.required' => '标题不能为空',
        'content.required' => '内容不能为空',

        'resource_business_id.required' => '资源商ID不能为空',
        'resource_business_id.integer' => '资源商ID格式不正确',
        'guid.required' => 'ID不能为空',
        'guid.size' => 'ID格式不正确',
        'collect_id.required' => '收藏ID不能为空',
        'guids.required' => 'ID不能为空',

        'is_recom.required' => '状态类型不能为空',
        'is_recom.integer' => '状态类型格式不正确',
        'is_recom.in' => '状态类型格式不正确',
    ];


    //自定义场景
    protected $scene = [
        'detail' => ['guid', 'resource_business_id'], //详情
        // 'add' => ['img', 'title', 'type_id', 'content'], //添加
        // 'change' => ['id', 'img', 'title', 'type_id', 'content'], //修改
        'del' => ['guid'], //删除
        'recom_and_cancel' => ['guids', 'is_recom'], //推荐与取消推荐

        'wx_batch_del_collect_book' => ['collect_id'], //批量删除收藏书架的书籍
        'wx_detail' => ['guid'], //详情
        'wx_collect_and_cancel' => ['guid'], //收藏与取消收藏
        'wx_get_book_catalogue' => ['guid', 'resource_business_id'], //获取图书目录
        'wx_get_book_skip_address' => ['guid', 'resource_business_id'], //获取图书跳转地址



        // 'wx_get_zwzx_single_sign' => ['guid', 'resource_business_id'], //获取中文在线单点登录信息

        // 'wx_get_bk_single_sign' => ['guid', 'resource_business_id'], //获取博看单点登录信息


        // 'get_ytys_chapter_audio_address' => ['chapter_id', 'resource_business_id'], //获取云图有声章节音频地址
        // 'get_xyts_chapter_audio_address' => ['guid', 'resource_business_id'], //获取新语听书章节音频地址

        // 'get_cdbt_chapter_audio_address' => ['guid', 'resource_business_id'], //获取自建电子书跳转地址

    ];
}
